{if condition="$class_info"}
{include file="Public/header" title="编辑班级"/}
{else/}
{include file="Public/header" title="添加班级"/}
{/if}
    <!-- 主容器 start -->
    <div id="container" class="container-fluid">
      <div class="row-fluid">

<!-- 左侧导航栏 start -->
{include file="Public/sidebar"/}
<!-- 左侧导航栏 end -->  
<!-- 主内容 start -->
<div id="content" class="span10">
  <!-- 标题 start -->
  <div class="pageTit page-header">
    <h1>{if condition="$class_info"}编辑{else/}添加{/if}班级 </h1>
    <div class="opt">
      <a class="btn btn-info" href="{:U('admin/class/index')}">返回班级列表</a>
    </div>
  </div>
  <!-- 标题 end -->
  <!-- 内容区块 start -->
  <div class="formBox">
      <form id="addform" action="{:U('admin/class/save')}" method="post" enctype="multipart/form-data">
      <input name="id" type="hidden" value="{$class_info.Id}" />
        <!-- 标题 -->
        <div class="control-group">
          <label>班级名称：(<font color="red">最少2个最多50个汉字</font>)</label>
          <input type="text" name="name" value="{$class_info.name}" {empty name="class_info"}ajaxurl="{:U("admin/class/check_title")}"{/empty} datatype="*2-50" nullmsg="请填写班级名称！" errormsg="班级名称至少2最多50个汉字！" />
          <span class="Validform_checktip"></span>
        </div>
          <div class="control-group">
              <label>专业选择：</label>
              <select style="width:90px" name="major_id" id="select_major">
                  <option value='' selected>暂无</option>
                  {$major_list = get_list('major')}
                  {volist name="major_list" id="vo"}
                  <option value="{$vo.Id}" {if condition="$vo['Id'] eq $class_info['major_id']"}selected{/if}>{$vo.name}</option>
                  {/volist}
              </select>
              <span class="Validform_checktip"></span>
          </div>
          <div style="clear: both"></div>
        <div class="control-group">
          <input type="submit" class="btn btn-primary Sub" value="保存" />
        </div>
    </form>
  </div>
  <!-- 内容区块 end -->
</div>
<!-- 主内容 end -->
<script>
$(function(){
  //提交表单合法性验证 
    $("#addform").Validform({ 
    tiptype:function(msg,o,cssctl){ 
      if(!o.obj.is("form")){ 
          var objtip=o.obj.siblings(".Validform_checktip");
          cssctl(objtip,o.type);
          objtip.text(msg); 
      }
    },
	label:"label",
    ajaxPost:true,
    callback:function(data){
      if(data.status=="ok"){
          alert(data.info);
		  window.location.href = "{:U('admin/class/index')}";
      }else{
        alert(data.info);
      }
    }
  });
})
</script>
   
      </div>
    </div>
    <!-- 主容器 end -->
{include file="Public/footer"/}